<%@page pageEncoding="utf-8" contentType="text/html; charset=utf-8" %>
<%@ include file="/admin/include/init_admin.jsp" %>
<%@ page import="com.joinhawaii.admin.sales.*" %>
<%

	HashList code007	= CommonUtil.getCodeList("007");	//호텔구분
	HashList code100	= CommonUtil.getCodeList("100");	//여행구분
	HashList code118	= CommonUtil.getCodeList("118");	//여행인원
	HashList code120	= CommonUtil.getCodeList("120");	//견적의뢰상태


	String job_type		= StringUtil.nvl(request.getParameter("job_type"), "U");
	String req_id		= StringUtil.nvl(request.getParameter("req_id"));



	HashMap infos = new HashMap();
	infos.put("req_id",	req_id);


	SalesDAO dao 	= new SalesDAO();
	HashList list 	= dao.selectReqInfo(infos);		//견적의뢰






	String s_req_dt			= StringUtil.nvl(request.getParameter("s_req_dt"));
	String s_start_dt_from	= StringUtil.nvl(request.getParameter("s_start_dt_from"));
	String s_start_dt_to	= StringUtil.nvl(request.getParameter("s_start_dt_to"));
	String s_req_status		= StringUtil.nvl(request.getParameter("s_req_status"));
	String s_customer_name	= StringUtil.toHan(request.getParameter("s_customer_name"));
	String s_email_addr		= StringUtil.toHan(request.getParameter("s_email_addr"));
	String s_phone_no		= StringUtil.nvl(request.getParameter("s_phone_no"));
	String s_hotel_name		= StringUtil.nvl(request.getParameter("s_hotel_name"));
	String s_enjoy_name		= StringUtil.nvl(request.getParameter("s_enjoy_name"));
	String s_car_company	= StringUtil.nvl(request.getParameter("s_car_company"));

	String s_hotel_chk		= StringUtil.nvl(request.getParameter("s_hotel_chk"));
	String s_enjoy_chk		= StringUtil.nvl(request.getParameter("s_enjoy_chk"));
	String s_car_chk		= StringUtil.nvl(request.getParameter("s_car_chk"));

	String s_curr_page		= StringUtil.nvl(request.getParameter("s_curr_page"),"1");



	String where = "?1=1";
	if (!"".equals(s_req_dt))			where += "&s_req_dt=" + s_req_dt;
	if (!"".equals(s_start_dt_from))	where += "&s_start_dt_from=" + s_start_dt_from;
	if (!"".equals(s_start_dt_to))		where += "&s_start_dt_to=" + s_start_dt_to;
	if (!"".equals(s_req_status))		where += "&s_req_status=" + s_req_status;
	if (!"".equals(s_customer_name))	where += "&s_customer_name=" + s_customer_name;
	if (!"".equals(s_email_addr))		where += "&s_email_addr=" + s_email_addr;
	if (!"".equals(s_phone_no))			where += "&s_phone_no=" + s_phone_no;
	if (!"".equals(s_hotel_name))		where += "&s_hotel_name=" + s_hotel_name;
	if (!"".equals(s_enjoy_name))		where += "&s_enjoy_name=" + s_enjoy_name;
	if (!"".equals(s_car_company))		where += "&s_car_company=" + s_car_company;
	if (!"".equals(s_hotel_chk))		where += "&s_hotel_chk=" + s_hotel_chk;
	if (!"".equals(s_enjoy_chk))		where += "&s_enjoy_chk=" + s_enjoy_chk;
	if (!"".equals(s_car_chk))			where += "&s_car_chk=" + s_car_chk;



%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
	<title>조인하와이</title>
	<%@ include file="/admin/include/cssnjs.jsp"  %>

	<script type="text/javascript">

	$(document).ready(function() {
		$('#start_dt').mask('9999.99.99').datepicker();
		$('#reqDetail').html('');
		$('#reqDetail').load('./reqDetail<%=StringUtil.nvl(list.get("req_gubn",0),"1")%>.jsp?req_id=<%=req_id%>&job_type=<%=job_type%>', '', function() {
			$('#start_dt').mask('9999.99.99').datepicker();
		});
	});


	function fnSave() {
		if (confirm(MSG_<%=job_type%>)) {
			$('#saveForm').attr('action', './reqSave.do');
			$('#saveForm').submit();
		}
	}

	function fnDelete() {
		if (confirm(MSG_D)) {
			$('#job_type').val('D');
			$('#saveForm').attr('action', './reqSave.do');
			$('#saveForm').submit();
		}
	}


	</script>
</head>
<body>
<div id="wrap">
	<div id="top">
		<%@ include file="/admin/include/top.jsp" %>
	</div>
	<div id="page">
		<div id="menu">
			<%@ include file="/admin/include/leftMenu.jsp" %>
		</div>
		<div id="contents">
			<div class="menu_title">
				<h1>견적의뢰</h1>
				<p>관리자 > 견적관리 > <b>견적의뢰</b></p>
			</div>
			<div class="clear line_01"></div>


			<ul id="tabs" class="tab_01 mt15">
			    <li class="on"  code="1"><p>1. <%= "2".equals(list.get("req_gubn",0)) ? "바로예약" : "견적의뢰" %></p></li>
			<%	if (!"".equals(req_id)) { %>
			    <a href="./estDetail.jsp<%=where%>&req_id=<%=req_id %>"><li class="off"  code="2"><p>2. 견적서</p></li></a>
			    <a href="./confirmDetail.jsp<%=where%>&req_id=<%=req_id %>"><li class="off"  code="3"><p>3. 예약확인서</p></li></a>
			<%	} %>
			</ul>


			<div id="tabs-1" class="mt15">

				<div id="reqDetail"></div>

				<div class="mt20 mb10 c">
					<a href="./reqList.jsp<%=where%>"><img src="/images/admin/btn_list.gif"/></a>
			<%	if ("U".equals(job_type)) { %>
					<a href="#nohref" onclick="fnSave()"><img src="/images/admin/btn_update.gif" /></a>
					<a href="#nohref" onclick="fnDelete()"><img src="/images/admin/btn_delete.gif" /></a>
			<%	} else if ("C".equals(job_type)) { %>
					<a href="#nohref" onclick="fnSave()"><img src="/images/admin/btn_register.gif" /></a>
			<%	} %>
				</div>


			</div>

		</div>
	</div>
</div>

</body>
</html>
